<%@ Page Language="C#" MasterPageFile="~/Administration/main.master" AutoEventWireup="true"
    CodeFile="Logs.aspx.cs" Inherits="Tathata.Web.Administration.Administration_Logs" %>

<asp:Content ID="c1" ContentPlaceHolderID="cph1" runat="Server">
    <h4>
        Log</h4>
    <br />
    <asp:Button ID="btnClear" runat="server" CssClass="adminButton" Text="Clear Log"
        OnClick="btnClear_Click" CausesValidation="false"></asp:Button>
    <br />
    <br />
    <asp:GridView ID="gvLogs" runat="server" AutoGenerateColumns="False" Width="100%"
        OnPageIndexChanging="gvLogs_PageIndexChanging" AllowPaging="true" PageSize="15">
        <Columns>
            <asp:BoundField DataField="LogID" HeaderText="Log ID" Visible="False"></asp:BoundField>
            <asp:BoundField DataField="LogType" HeaderText="Log type" ItemStyle-Width="12%">
            </asp:BoundField>
            <asp:TemplateField HeaderText="Customer" ItemStyle-Width="15%">
                <ItemTemplate>
                    <%#GetCustomerInfo(Convert.ToInt32(Eval("CustomerID")))%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CreatedOn" HeaderText="Created on" HeaderStyle-HorizontalAlign="Center"
                ItemStyle-Width="18%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
            <asp:TemplateField HeaderText="Message" ItemStyle-Width="20%">
                <ItemTemplate>
                    <a href="LogDetails.aspx?LogID=<%#Eval("LogID")%>">
                        <%#Server.HtmlEncode(Eval("Message").ToString())%>
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Details" ItemStyle-Width="15%">
                <ItemTemplate>
                    <a href="LogDetails.aspx?LogID=<%#Eval("LogID")%>">Details</a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
                ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Button ID="DeleteLogButton" runat="server" CssClass="adminButton" CommandName="DeleteLog"
                        Text="Delete" CommandArgument='<%#Eval("LogID")%>' OnCommand="DeleteLogButton_OnCommand"
                        CausesValidation="false" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>
